<?php
	$id = $_GET['msp'];
	
	$sanpham = new sanphambs();
	$sanpham->MaSanPham = $id;
	$kq = $sanpham->Delete();
	
	$hinhanh = new hinhanhbs();
	$hinhanh->MaSanPham = $id;
	$ds = $hinhanh->GetList();
	for($i = 0; $i < count($ds); $i++)
	{
		unlink($ds[$i]['patch']);
	}
	$kqhinh = $hinhanh->Delete();
	
	if($kq && $kqhinh)
	{
		header("Location: index.php?do=sanpham");
	}
	else
	{
		echo "Lỗi: " . mysql_error();
	}
?>